<template>
  <div id="app">
    <Editor
      v-if="show"
      class="editor"
      :articleContent="articleContent"
    ></Editor>
  </div>
</template>

<script>
import Editor from './components/Editor.vue'
export default {
  name: 'App',
  components: { Editor },
  data () {
    return {
      articleContent: null,
      show: false
    }
  },
  created () {
    this.getArticleData('../static/articleTemplate.json')
  },
  methods: {
    // 获取文章模板
    getArticleData (url) {
      let self = this
      this.$axios.get(url).then(res => {
        if (res.data) {
          self.articleContent = res.data
        }
        self.show = true
      })
    }
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.editor {
  position: relative;
  margin: 40px auto 0 auto;
  width: 694px;
  height: 90vh;
}
</style>
